********************************************************************************
****							Analyses								 	****
********************************************************************************
use "\aida_mig.dta", clear

********************************************************************************
*** Weights
	
	svyset [pweight=mz_w2]
	
*** Install packages for exporting output
	*ssc install asdoc
	*ssc install estout
	*ssc install outreg2

********************************************************************************
****						MODEL 1 - Household Level						****
********************************************************************************

*** Descriptives 	
	sum poverty_risk family_mum gen_sta region casmin_mum working_mum age_mum alt_jk nr_kids_hh if hhid==1
	bys gen_sta: sum poverty_risk family_mum region casmin_mum working_mum age_mum alt_jk nr_kids_hh if hhid==1

	// Generate dummies for tables
		ta GESCHLECHT, gen(dum_sex)
		lab var dum_sex1 "Male"
		lab var dum_sex2 "Female"
		lab var dum_sex3 "Diverse"
		tab generation, gen(dum_gen)
		label var dum_gen1 "Non-immigrant"
		label var dum_gen2 "1. Gen."
		label var dum_gen3 "2. Gen."
		tab gen_sta, gen(dum_gensta)
		lab var dum_gensta1 "Non-immigrant"
		lab var dum_gensta2 "1. Gen. - German"
		lab var dum_gensta3 "1 Gen. - EU"
		lab var dum_gensta4 "1. Gen. - non-EU"
		lab var dum_gensta5 "2. Gen."
		tab casmin_mu, gen(dum_cas)
		label var dum_cas1 "No degree" 
		label var dum_cas2 "Some secondary education"
		label var dum_cas3 "College degree"
		label var dum_cas4 "University degree"
		tab working_mum, gen(dum_ws)
		label var dum_ws1 "Not Working"
		label var dum_ws2 "Part time"
		label var dum_ws3 "Full time"
		tab nr_kids_hh, gen(dum_nrkids) 
		label var dum_nrkids1 "1 child"
		label var dum_nrkids2 "2 children"
		label var dum_nrkids3 "3 children or more"
	
	// Descriptives by immigrant status and family form
	
		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)

		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)

		eststo sum_hh0_gensta

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)

		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==1 & gen_sta==0

		eststo sum_hh1_gensta0

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)
		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==1 & gen_sta==1

		eststo sum_hh1_gensta1

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)
		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==1 & gen_sta==2

		eststo sum_hh1_gensta2

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)
		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==1 & gen_sta==3

		eststo sum_hh1_gensta3

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)
		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==1 & gen_sta==4

		eststo sum_hh1_gensta4


		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)

		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==0 & gen_sta==0

		eststo sum_hh2_gensta0

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)

		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==0 & gen_sta==1 

		eststo sum_hh2_gensta1

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)

		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==0 & gen_sta==2 

		eststo sum_hh2_gensta2

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)

		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==0 & gen_sta==3

		eststo sum_hh2_gensta3

		regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)

		estpost summarize region poverty_risk dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample) & family_mum==0 & gen_sta==4 

		eststo sum_hh2_gensta4

		// Combine stored results and export
		esttab sum_hh0_gensta sum_hh2_gensta0 sum_hh2_gensta1 sum_hh2_gensta2 sum_hh2_gensta3 sum_hh2_gensta4 sum_hh1_gensta0 ///
			sum_hh1_gensta1 sum_hh1_gensta2 sum_hh1_gensta3 sum_hh1_gensta4 using new_sum_hh_mums_gensta_all.rtf, replace main(mean %6.2f) aux(sd) ///
			mtitle("Full Sample" "1. - German" "1. - 1. Gen. (GER)" "1. - 1. Gen. (EU)" ///
			"1. - 1. Gen. (non-EU)" "1. - 2. Gen."  "2. - German" ///
			"2. - 1. Gen. (GER)" "2. - 1. Gen. (EU)" "2. - 1. Gen. (non-EU)" ///
			"2. - 2. Gen.") title("Household Level") label compress
			
		esttab sum_hh0_gensta sum_hh2_gensta0 sum_hh2_gensta1 sum_hh2_gensta2 sum_hh2_gensta3 sum_hh2_gensta4 sum_hh1_gensta0 ///
			sum_hh1_gensta1 sum_hh1_gensta2 sum_hh1_gensta3 sum_hh1_gensta4 using new_sum_hh_mums_gensta_all.tex, replace main(mean %6.2f) aux(sd) ///
			mtitle("Full Sample" "1. - German" "1. - 1. Gen. (GER)" "1. - 1. Gen. (EU)" ///
			"1. - 1. Gen. (non-EU)" "1. - 2. Gen."  "2. - German" ///
			"2. - 1. Gen. (GER)" "2. - 1. Gen. (EU)" "2. - 1. Gen. (non-EU)" ///
			"2. - 2. Gen.") title("Household Level") label compress

			
*** Bivariate vs. multivariate model: poverty risk (household level) ***
*** Simple Model: Poverty Risk
	// Group-prop (Predicted Probabilities)
	regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)
	margins family_mum#gen_sta, saving(m1_ols_mums_simple_nw_group-prop_gensta, replace)
	
	// Weighted
	svy: regress poverty_risk i.family_mum##i.gen_sta if hhid==1, allbaselevels 
	*eststo: margins family_mum#gen_sta, post 
	margins family_mum#gen_sta, saving(m1_ols_mums_simple_w_group-prop_gensta, replace)
		
	// Family effect (Contrasts of Margins)
	regress poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)
	margins r.family_mum@gen_sta, saving(m1_ols_mums_simple_nw_family-effect_gensta, replace)
	
	// Weighted
	svy: regress poverty_risk i.family_mum##i.gen_sta if hhid==1, allbaselevels
	margins r.family_mum@gen_sta, post saving(m1_ols_mums_simple_w_family-effect_gensta, replace)

// Full Model: Poverty Risk
	// Group-prop (Predicted Probabilities)
	regress poverty_risk i.family_mum##i.gen_sta i.region i.casmin_mum ///
		i.working_mum age_mum alt_jk i.nr_kids_hh if hhid==1,  vce(robust)
	outreg2 using M1_Reg-table_ungewichtet, excel dec(3) tex ///
		title("Regression table for Model 1, Weighted and not weighted") label replace
	margins family_mum#gen_sta, atmeans saving(m1_ols_mums_full_gen_sta_nw_group-prop, replace)
	
	// Weighted
	svy: regress poverty_risk i.family_mum##i.gen_sta i.region i.casmin_mum ///
		i.working_mum age_mum alt_jk i.nr_kids_hh if hhid==1
	outreg2 using M1_Reg-table_ungewichtet, excel dec(3) tex ///
		title("Regression table for Model 1, Weighted and not weighted") label
	margins family_mum#gen_sta, post atmeans saving(m1_ols_mums_full_gen_sta_w_group-prop, replace)
	
			
	// Family effect (Contrasts of Margins)
	regress poverty_risk i.family_mum##i.gen_sta region i.casmin_mum ///
		i.working_mum age_mum alt_jk i.nr_kids_hh if hhid==1, allbaselevels vce(robust)
	margins r.family_mum@gen_sta, atmeans saving(m1_ols_mums_full_gen_sta_nw_family-effect, replace)
	
	// Weighted
	svy: regress poverty_risk i.family_mum##i.gen_sta region i.casmin_mum ///
		i.working_mum age_mum alt_jk i.nr_kids_hh if hhid==1, allbaselevels 
	margins r.family_mum@gen_sta, atmeans post saving(m1_ols_mums_full_gen_sta_w_family-effect, replace)	
		

*** Logit-Model: Poverty Risk
	// Robustness Check
	
	* Simple Model
		// group-prop
		logit poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)
		margins family_mum#gen_sta, saving(m1_lo_mums_simple_nw_group-prop_gensta, replace)
		
		svy: logit poverty_risk i.family_mum##i.gen_sta if hhid==1, allbaselevels 
		*eststo: margins family_mum#generation, post 
		margins family_mum#gen_sta, post saving(m1_lo_mums_simple_w_group-prop_gensta, replace)
		
		// family effect
		logit poverty_risk i.family_mum##i.gen_sta if hhid==1, vce(robust)
		margins r.family_mum@gen_sta, saving(m1_lo_mums_simple_nw_family-effect_gensta, replace)
		
		svy: logit poverty_risk i.family_mum##i.gen_sta if hhid==1, allbaselevels
		margins r.family_mum@gen_sta, post saving(m1_lo_mums_simple_w_family-effect_gensta, replace)

	* Full Model
		// group-prop	
		logit poverty_risk i.family_mum##i.gen_sta i.region i.casmin_mum i.working_mum age_mum alt_jk i.nr_kids_hh if hhid==1,  vce(robust)
		outreg2 using M1_Reg-table_ungewichtet_logit, excel dec(3) tex title("Regression table for Model 1, Weighted and not weighted, Logit") label replace 
		margins family_mum#gen_sta, atmeans saving(m1_lo_mums_full_gen_sta_nw_group-prop, replace)
	
		// weighted
		svy: logit poverty_risk i.family_mum##i.gen_sta i.region i.casmin_mum i.working_mum age_mum alt_jk i.nr_kids_hh if hhid==1
		outreg2 using M1_Reg-table_ungewichtet_logit, excel dec(3) tex title("Regression table for Model 1, Weighted and not weighted, Logit") label
		margins family_mum#gen_sta, post atmeans saving(m1_lo_mums_full_gen_sta_w_group-prop, replace)
	
			
		// family effect
		logit poverty_risk i.family_mum##i.gen_sta region i.casmin_mum i.working_mum age_mum alt_jk i.nr_kids_hh if hhid==1, allbaselevels vce(robust)
		margins r.family_mum@gen_sta, atmeans saving(m1_ols_mums_full_gen_sta_nw_family-effect, replace)
		
		// Weighted
		svy: logit poverty_risk i.family_mum##i.gen_sta region i.casmin_mum i.working_mum age_mum alt_jk i.nr_kids_hh if hhid==1, allbaselevels 
		margins r.family_mum@gen_sta, atmeans post saving(m1_ols_mums_full_gen_sta_w_family-effect, replace)
		
		
********************************************************************************
****						MODEL 2 - Mother Level						****
********************************************************************************

*** Descriptives 	
	sum life_satis family_mum gen_sta region casmin_mum working_mum age_mum alt_jk nr_kids_hh aequi_1000 if k_IstETvonZP17==1 & GESCHLECHT==2
	bys gen_sta: sum life_satis family_mum region casmin_mum working_mum age_mum alt_jk nr_kids_hh aequi_1000 if k_IstETvonZP17==1 & GESCHLECHT==2
	
	bysort family_mum: sum life_satis if k_IstETvonZP17==1 & GESCHLECHT==2
	
	// Descriptives by immigrant status and family form
	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)

	eststo sum_parents0

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==0 & gen_sta==0
	eststo sum_parents10

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==0 & gen_sta==1
	eststo sum_parents11

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==0 & gen_sta==2
	eststo sum_parents12

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==0 & gen_sta==3
	eststo sum_parents13

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==0 & gen_sta==4
	eststo sum_parents14

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==1 & gen_sta==0
	eststo sum_parents20

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==1 & gen_sta==1
	eststo sum_parents21

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==1 & gen_sta==2
	eststo sum_parents22

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==1 & gen_sta==3
	eststo sum_parents23

	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	estpost summarize dum_gensta1 dum_gensta2 dum_gensta3 dum_gensta4 dum_gensta5 life_satis region aequi_1000 dum_cas1 dum_cas2 dum_cas3 dum_cas4 dum_ws1 dum_ws2 dum_ws3 age_mum alt_jk dum_nrkids1 dum_nrkids2 dum_nrkids3 if e(sample)  & family_mum==1 & gen_sta==4
	eststo sum_parents24

	esttab sum_parents0 sum_parents10 sum_parents11 sum_parents12 sum_parents13 sum_parents14 ///
		sum_parents20 sum_parents21 sum_parents22 sum_parents23 sum_parents24 ///
		using new_sum_par_mums_all.rtf, replace main(mean %6.2f) aux(sd) mtitle("Full Sample" "1. - German" "1. - 1. Gen. (GER)" "1. - 1. Gen. (EU)" ///
		"1. - 1. Gen. (non-EU)" "1. - 2. Gen."  "2. - German" ///
		"2. - 1. Gen. (GER)" "2. - 1. Gen. (EU)" "2. - 1. Gen. (non-EU)" ///
		"2. - 2. Gen.") title("Mother Level") label compress
	esttab sum_parents0 sum_parents10 sum_parents11 sum_parents12 sum_parents13 sum_parents14 ///
		sum_parents20 sum_parents21 sum_parents22 sum_parents23 sum_parents24 ///
		using new_sum_par_mums_all.tex, replace main(mean %6.2f) aux(sd) mtitle("Full Sample" "1. - German" "1. - 1. Gen. (GER)" "1. - 1. Gen. (EU)" ///
		"1. - 1. Gen. (non-EU)" "1. - 2. Gen."  "2. - German" ///
		"2. - 1. Gen. (GER)" "2. - 1. Gen. (EU)" "2. - 1. Gen. (non-EU)" ///
		"2. - 2. Gen.") title("Mother Level") label compress
	
 
*** Bivariate vs. multivariate Models: Life Satisfaction of Mothers

// Simple Model
	// group-prop
	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	margins family_mum#gen_sta, saving(m2_ols_mums_gensta_simple_nw_group-prop_neu, replace)
	
	
	svy: reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2
	margins family_mum#gen_sta, saving(m2_ols_mums_gensta_simple_w_group-prop_neu, replace)
	
	
	//family-effect
	reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
	margins r.family_mum@gen_sta, saving(m2_ols_mums_gensta_simple_nw_family-effect_neu, replace)
	
	svy: reg life_satis i.family_mum##gen_sta if k_IstETvonZP17==1 & GESCHLECHT==2
	margins r.family_mum@gen_sta, saving(m2_ols_mums_gensta_simple_w_family-effect_neu, replace)
		
		
// FULL MODEL
	// group-prop
		reg life_satis i.family_mum##gen_sta i.region i.casmin_mum i.working_mum ///
			aequi_1000 age_mum alt_jk i.nr_kids_hh if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
		margins family_mum#gen_sta, atmeans saving(m2_ols_mums_gensta_full_nw_group-prop_neu, replace)
		outreg2 using M2_Reg-table_ungewichtet, excel dec(3) tex ///
			title("Regression table for Parent Models") label replace

		
		
		svy: reg life_satis i.family_mum##gen_sta i.region i.casmin_mum ///
			i.working_mum aequi_1000 age_mum alt_jk i.nr_kids_hh if k_IstETvonZP17==1 & GESCHLECHT==2
		outreg2 using M2_Reg-table_ungewichtet, excel dec(3) tex ///
			title("Regression table for Parent Models") label
	
		margins family_mum#gen_sta, atmeans post saving(m2_ols_mums_gensta_full_w_group-prop_neu, replace)
		
	// family-effect
		reg life_satis i.family_mum##gen_sta i.region i.casmin_mum ///
			i.working_mum k_aequi_mean_hh age_mum alt_jk i.nr_kids_hh if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
		margins r.family_mum@gen_sta, atmeans saving(m2_ols_mums_gensta_full_nw_family-effect_neu, replace)
		
		svy: reg life_satis i.family_mum##gen_sta i.region i.casmin_mum ///
			i.working_mum k_aequi_mean_hh age_mum  alt_jk i.nr_kids_hh if k_IstETvonZP17==1 & GESCHLECHT==2
		margins r.family_mum@gen_sta, atmeans saving(m2_ols_mums_gensta_full_w_family-effect_neu, replace)

******************* Robustness Check: Models without Income
		
// FULL MODEL
	// group-prop
		reg life_satis i.family_mum##gen_sta i.region i.casmin_mum ///
			i.working_mum age_mum alt_jk i.nr_kids_hh if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
		margins family_mum#gen_sta, atmeans post 
		outreg2 using M2_Reg-table_ohne-SES, excel dec(3) tex title("Predicted Probabilities") label
		
		svy: reg life_satis i.family_mum##gen_sta i.region i.casmin_mum ///
			i.working_mum age_mum alt_jk i.nr_kids_hh if k_IstETvonZP17==1 & GESCHLECHT==2
		*outreg2 using M2_Reg-table_ungewichtet, excel dec(3) tex title("Regression table for Parent Models") label
	
		margins family_mum#gen_sta, atmeans post
		
	// family-effect
		reg life_satis i.family_mum##gen_sta i.region i.casmin_mum ///
			i.working_mum age_mum alt_jk i.nr_kids_hh if k_IstETvonZP17==1 & GESCHLECHT==2, vce(robust)
		margins r.family_mum@gen_sta, atmeans 
		
		svy: reg life_satis i.family_mum##gen_sta i.region i.casmin_mum ///
			i.working_mum age_mum  alt_jk i.nr_kids_hh if k_IstETvonZP17==1 & GESCHLECHT==2
		margins r.family_mum@gen_sta, atmeans 	

		
********************************************************************************	

save "\aida_mig.dta", replace
